#%RAML 1.0
title: Institution level location unit
version: v2.0
protocols: [ HTTP, HTTPS ]
baseUri: http://github.com/org/folio/mod-inventory-storage

documentation:
  - title: Location units
    content: This documents the API calls that can be made to query and manage
      location units like institutions, campuses, and libraries

types:
  locinst: !include locinst.json
  locinsts: !include locinsts.json
  loccamp: !include loccamp.json
  loccamps: !include loccamps.json
  loclib: !include loclib.json
  loclibs: !include loclibs.json
  errors: !include raml-util/schemas/errors.schema

traits:
  pageable: !include raml-util/traits/pageable.raml
  searchable: !include raml-util/traits/searchable.raml
  language: !include raml-util/traits/language.raml
  validate: !include raml-util/traits/validation.raml

resourceTypes:
  collection: !include raml-util/rtypes/collection.raml
  collection-item: !include raml-util/rtypes/item-collection.raml
  get-delete-only: !include raml-util/rtypes/get-delete.raml

/location-units:
  /institutions:
    type:
      collection:
        exampleCollection: !include examples/locinsts.json
        exampleItem: !include examples/locinst.json
        schemaCollection: locinsts
        schemaItem: locinst
    get:
      is: [
        searchable: {description: "with valid searchable fields", example: "name=aaa"},
        pageable
      ]
      description: Return a list of institutions
    post:
      description: Create a new institution
      is: [validate]
    delete:
      description: "Delete all institutions"
      is: [language]
      responses:
        204:
          description: "All institutions deleted"
        500:
          description: "Internal server error, e.g. due to misconfiguration"
          body:
            text/plain:
              example: "Internal server error, contact administrator"
    /{id}:
      description: "Pass in the institution id"
      type:
        collection-item:
          exampleItem: !include examples/locinst.json
          schema: locinst
      get:
      put:
      delete:
  /campuses:
    type:
      collection:
        exampleCollection: !include examples/loccamps.json
        exampleItem: !include examples/loccamp.json
        schemaCollection: loccamps
        schemaItem: loccamp
    get:
      is: [
        searchable: {description: "with valid searchable fields", example: "name=aaa"},
        pageable
      ]
      description: Return a list of campuses
    post:
      description: Create a new campus
      is: [validate]
    delete:
      description: "Delete all campuses"
      is: [language]
      responses:
        204:
          description: "All campuses deleted"
        500:
          description: "Internal server error, e.g. due to misconfiguration"
          body:
            text/plain:
              example: "Internal server error, contact administrator"
    /{id}:
      description: "Pass in the campus id"
      type:
        collection-item:
          exampleItem: !include examples/loccamp.json
          schema: loccamp
      get:
      put:
      delete:
  /libraries:
    type:
      collection:
        exampleCollection: !include examples/loclibs.json
        exampleItem: !include examples/loclib.json
        schemaCollection: loclibs
        schemaItem: loclib
    get:
      is: [
        searchable: {description: "with valid searchable fields", example: "name=aaa"},
        pageable
      ]
      description: Return a list of libraries
    post:
      description: Create a new library
      is: [validate]
    delete:
      description: "Delete all libraries"
      is: [language]
      responses:
        204:
          description: "All libraries deleted"
        500:
          description: "Internal server error, e.g. due to misconfiguration"
          body:
            text/plain:
              example: "Internal server error, contact administrator"
    /{id}:
      description: "Pass in the library id"
      type:
        collection-item:
          exampleItem: !include examples/loclib.json
          schema: loclib
      get:
      put:
      delete:
